<?php
$ipAdd = Yii::app()->user->getState('ipAddress');
?>
<!--
<div>
<?php //$this->render('cmswidgets.views.notification_frontend'); ?>
</div>
-->
<style>
    .register-form{padding:5px; }
    fieldset.register-form-account-infomation{
        border:1px solid #ccc;
        padding:5px;border-radius: 2px;
    }
    fieldset.register-form-account-infomation legend{
        margin-left: 20px;
        padding:0px 5px;
        font-weight: bold;
    }
    fieldset.register-form-account-infomation input[type='text'],fieldset.register-form-account-infomation input[type='password']{
        border: 1px solid #ccc;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12) inset;
        margin-top: 5px;
        padding: 3px 0 3px 3px;
        width: 97%;
        border-radius: 2px;
    }
    fieldset.register-form-account-infomation input[type='text']:focus,fieldset.register-form-account-infomation input[type='password']:focus{
        border-color: #7dc9e2;
        outline-color: #dceefc;
    }
    /* address */
    fieldset.register-form-address{
        border:1px solid #ccc;
        padding:5px;border-radius: 2px;
    }
    fieldset.register-form-address legend{
        margin-left: 20px;
        padding:0px 5px;
        font-weight: bold;
    }
    fieldset.register-form-address input[type='text'],fieldset.register-form-address input[type='password']{
        border: 1px solid #ccc;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12) inset;
        margin-top: 5px;
        padding: 3px 0 3px 3px;
        width: 97%;
        border-radius: 2px;
    }
    fieldset.register-form-address input[type='text']:focus,fieldset.register-form-address input[type='password']:focus{
        border-color: #7dc9e2;
        outline-color: #dceefc;
    }
    /* end address*/
    .buttonsubmit-register{
        background-color: #2cb2bc;
        border: 0 none;
        border-radius: 3px;
        color: #fff;
        display: inline-block;
        line-height: 22px;
        /*
        padding: 0 15px;
        margin-left: 120px;
        */
        font-weight: bold;
    }
    .buttonsubmit-register:hover{
        background-color: #47cad4;
        cursor: pointer;
        color: #fff;
        -webkit-transition: all .15s ease-in;
        -moz-transition: all .15s ease-in;
        -ms-transition: all .15s ease-in;
        -o-transition: all .15s ease-in;
        transition: all .15s ease-in;
    }
    span.required{ color: red;}
    .errorMessage{ color: red;}
</style>
<div class="register-form">
    <?php
    $form = $this->beginWidget('CActiveForm', array(
        'id' => 'form_register',
        'enableAjaxValidation' => false,
        'enableClientValidation' => true,
        'clientOptions' => array(
            'validateOnSubmit' => true,
        ),
    ));
    echo $form->hiddenField($model, 'ipAddress', array('value' => $ipAdd->ipAddress));
    echo $form->hiddenField($model, 'countryCode', array('value' => $ipAdd->countryCode))
    ?>  
    <fieldset class="register-form-account-infomation">
        <legend>Account Information</legend>
        <div>
            <table>
                <tr>
                    <td width="120"><?= $form->labelEx($model, 'username') ?></td>
                    <td width="260"><?= $form->textField($model, 'username', array('class' => '')) ?></td>
                    <td><?= $form->error($model, 'username', array()) ?></td>
                </tr>
                <tr>
                    <td><?= $form->labelEx($model, 'email') ?></td>
                    <td><?= $form->textField($model, 'email', array('class' => '')) ?></td>
                    <td><?= $form->error($model, 'email', array()) ?></td>
                </tr>
                <tr>
                    <td><?= $form->labelEx($model, 'password') ?></td>
                    <td><?= $form->passwordField($model, 'password', array('class' => '')) ?></td>
                    <td><?= $form->error($model, 'password', array()) ?></td>
                </tr>
                <tr>
                    <td></td>
                    <td colspan="2">Password bắt buộc phải có: 1 ký tự viết hoa <b>(A-Z)</b> + ít nhất 1 ký tự số <b>(0-9)</b> + ít nhất 1 ký tự đặc biệt <b>( - _ ! @ # $ % ^ & * ( ) + = ? . ,)</b></td>
                </tr>
                <tr>
                    <td><?= $form->labelEx($model, 'passwordConfirm') ?></td>
                    <td><?= $form->passwordField($model, 'passwordConfirm', array('class' => '')) ?></td>
                    <td><?= $form->error($model, 'passwordConfirm', array()) ?></td>
                </tr>
            </table>
        </div>
    </fieldset>
    <fieldset class="register-form-address">
        <legend>Address</legend>
        <div class="create_new_account">
            <table>
                <tr>
                    <td width="120"><?= $form->labelEx($model, 'displayName') ?></td>
                    <td width="260"><?= $form->textField($model, 'displayName', array('class' => '')) ?></td>
                    <td><?= $form->error($model, 'displayName', array()) ?></td>
                </tr>
                <tr>
                    <td><?= $form->labelEx($model, 'phone') ?></td>
                    <td><?= $form->textField($model, 'phone', array('class' => '')) ?></td>
                    <td><?= $form->error($model, 'phone', array()) ?></td>
                </tr>
                <tr>
                    <td><?= $form->labelEx($model, 'company') ?></td>
                    <td><?= $form->textField($model, 'company', array('class' => '')) ?></td>
                    <td><?= $form->error($model, 'company', array()) ?></td>
                </tr>
                <tr>
                    <td><?= $form->labelEx($model, 'street') ?></td>
                    <td><?= $form->textField($model, 'street', array('class' => '')) ?></td>
                    <td><?= $form->error($model, 'street', array()) ?></td>
                </tr>
                <tr>
                    <td><?= $form->labelEx($model, 'city') ?></td>
                    <td><?= $form->textField($model, 'city', array('class' => '', 'value' => $ipAdd->cityName)) ?></td>
                    <td><?= $form->error($model, 'city', array()) ?></td>
                </tr>
                <tr>
                    <td><?= $form->labelEx($model, 'region') ?></td>
                    <td><?= $form->textField($model, 'region', array('class' => '', 'value' => $ipAdd->regionName)) ?></td>
                    <td><?= $form->error($model, 'region', array()) ?></td>
                </tr>
                <tr>
                    <td><?= $form->labelEx($model, 'zipCode') ?></td>
                    <td><?= $form->textField($model, 'zipCode', array('class' => '', 'value' => $ipAdd->zipCode)) ?></td>
                    <td><?= $form->error($model, 'zipCode', array()) ?></td>
                </tr>                        
            </table>
        </div>
    </fieldset>
    <div style="margin: 20px 0;">
        <input class="buttonsubmit-register" type="submit" name="submit" value="Create New Account">
    </div>
    <?php $this->endWidget(); ?>        
</div>